package com.link2room.aeriabots.facade.impl;

import com.link2room.aeriabots.dto.param.base.WxScanCountDetailDto;
import com.link2room.aeriabots.dto.param.inside.WxScanCountDetailFindParamDto;
import com.link2room.aeriabots.entity.WxQrcodeScanDetailEntity;
import com.link2room.aeriabots.facade.IWxScanCountFacadeService;
import com.link2room.common.jpa.result.QueryResult;
import com.link2room.common.service.ICommonService;
import com.link2room.common.util.ClassConverUtil;
import com.link2room.common.util.L2RAssert;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * Created by LN on 2017/11/21
 */
@Component("wxScanCountFacadeService")
public class WxScanCountFacadeServiceImpl implements IWxScanCountFacadeService {
    @Resource
    private ICommonService commonService;
    @Override
    public QueryResult<WxScanCountDetailDto> findScanCountDetail(WxScanCountDetailFindParamDto paramDto) throws Exception {
        String qrKey = paramDto.getQrKey();
        String qrType = paramDto.getQrType();
        String scanType = paramDto.getScanType();
        String openid = paramDto.getOpenid();
        String lhotelGroupCode = paramDto.getLhotelGroupCode();
        WxQrcodeScanDetailEntity findCount = new WxQrcodeScanDetailEntity();
        findCount.setOpenid(openid);
        findCount.setScanType(scanType);
        findCount.setQrKey(qrKey);
        findCount.setQrType(qrType);
        findCount.setLhotelGroupCode(lhotelGroupCode);
        QueryResult<WxQrcodeScanDetailEntity> qres = commonService.findAllEQ(WxQrcodeScanDetailEntity.class, findCount, paramDto.getCurrentPage(), paramDto.getPageSize());
        return ClassConverUtil.copyQueryResultToDtoQueryResult(qres,WxScanCountDetailDto.class,false);
    }
}
